<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <title>c在线编译器</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <meta name="robots" content="index,follow">
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="c在线编译器">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="/static/toget/bootstrap.min.css">

    <!-- 可选的Bootstrap主题文件（一般不用引入） -->
    <link rel="stylesheet" href="/static/toget/bootstrap-theme.min.css">
    <script src="/static/toget/hm.js"></script>
    <script src="/static/toget/hm(1).js"></script>
    <script>
        if (!document.addEventListener) {
            // IE6~IE8
            //document.write('<script src="../bower/ieBetter.js/ieBetter.js"><\/script>');
        }</script>
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="/static/toget/jquery.min.js"></script>
    <script src="/static/toget/jstorage.min.js"></script>
    <script src="/static/toget/base64.min.js"></script>
    <script>
        var codetype = "c";
        var unid = "5e947fbac6ce8";
    </script>
    <script src="/static/toget/runcode.js"></script>
    <script src="/static/toget/jquery-ui.min.js"></script>
    <script src="/static/toget/jquery.layout-latest.min.js"></script>
    <style>
        /*
        html, body {
            font-family: Arial, sans-serif;
            font-size: 14px;
            -webkit-font-smoothing: antialiased;
            font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }*/
        body {
            padding-top: 0px;
        }

        .starter-template {
            padding: 40px 15px;

        }

        .CodeMirror {
            border-top: 1px solid black;
            border-bottom: 1px solid black;
        }


        .lead a {
            font-size: 14px;
        }

        .list-inline > li {
            display: inline-block;
            padding-right: 5px;
            padding-left: 5px;
            width: 110px;
            font-size: 16px;

        }

        .list-inline a {
            font-weight: bold;
        }
    </style>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "//hm.baidu.com/hm.js?9ca52cb36718c4a9ba90bc98d917c8bf";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

    <style id="ace_editor.css">.ace_editor {
        position: relative;
        overflow: hidden;
        font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
        direction: ltr;
    }

    .ace_scroller {
        position: absolute;
        overflow: hidden;
        top: 0;
        bottom: 0;
        background-color: inherit;
        -ms-user-select: none;
        -moz-user-select: none;
        -webkit-user-select: none;
        user-select: none;
        cursor: text;
    }

    .ace_content {
        position: absolute;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        min-width: 100%;
    }

    .ace_dragging .ace_scroller:before {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        content: '';
        background: rgba(250, 250, 250, 0.01);
        z-index: 1000;
    }

    .ace_dragging.ace_dark .ace_scroller:before {
        background: rgba(0, 0, 0, 0.01);
    }

    .ace_selecting, .ace_selecting * {
        cursor: text !important;
    }

    .ace_gutter {
        position: absolute;
        overflow: hidden;
        width: auto;
        top: 0;
        bottom: 0;
        left: 0;
        cursor: default;
        z-index: 4;
        -ms-user-select: none;
        -moz-user-select: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .ace_gutter-active-line {
        position: absolute;
        left: 0;
        right: 0;
    }

    .ace_scroller.ace_scroll-left {
        box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
    }

    .ace_gutter-cell {
        padding-left: 19px;
        padding-right: 6px;
        background-repeat: no-repeat;
    }




    .ace_scrollbar {
        position: absolute;
        right: 0;
        bottom: 0;
        z-index: 6;
    }

    .ace_scrollbar-inner {
        position: absolute;
        cursor: text;
        left: 0;
        top: 0;
    }

    .ace_scrollbar-v {
        overflow-x: hidden;
        overflow-y: scroll;
        top: 0;
    }

    .ace_scrollbar-h {
        overflow-x: scroll;
        overflow-y: hidden;
        left: 0;
    }

    .ace_print-margin {
        position: absolute;
        height: 100%;
    }

    .ace_text-input {
        position: absolute;
        z-index: 0;
        width: 0.5em;
        height: 1em;
        opacity: 0;
        background: transparent;
        -moz-appearance: none;
        appearance: none;
        border: none;
        resize: none;
        outline: none;
        overflow: hidden;
        font: inherit;
        padding: 0 1px;
        margin: 0 -1px;
        text-indent: -1em;
        -ms-user-select: text;
        -moz-user-select: text;
        -webkit-user-select: text;
        user-select: text;
        white-space: pre !important;
    }

    .ace_text-input.ace_composition {
        background: inherit;
        color: inherit;
        z-index: 1000;
        opacity: 1;
        text-indent: 0;
    }

    .ace_layer {
        z-index: 1;
        position: absolute;
        overflow: hidden;
        word-wrap: normal;
        white-space: pre;
        height: 100%;
        width: 100%;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        pointer-events: none;
    }

    .ace_gutter-layer {
        position: relative;
        width: auto;
        text-align: right;
        pointer-events: auto;
    }

    .ace_text-layer {
        font: inherit !important;
    }

    .ace_cjk {
        display: inline-block;
        text-align: center;
    }

    .ace_cursor-layer {
        z-index: 4;
    }

    .ace_cursor {
        z-index: 4;
        position: absolute;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border-left: 2px solid;
        transform: translatez(0);
    }

    .ace_slim-cursors .ace_cursor {
        border-left-width: 1px;
    }

    .ace_overwrite-cursors .ace_cursor {
        border-left-width: 0;
        border-bottom: 1px solid;
    }

    .ace_hidden-cursors .ace_cursor {
        opacity: 0.2;
    }

    .ace_smooth-blinking .ace_cursor {
        -webkit-transition: opacity 0.18s;
        transition: opacity 0.18s;
    }

    .ace_editor.ace_multiselect .ace_cursor {
        border-left-width: 1px;
    }

    .ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
        position: absolute;
        z-index: 3;
    }

    .ace_marker-layer .ace_selection {
        position: absolute;
        z-index: 5;
    }

    .ace_marker-layer .ace_bracket {
        position: absolute;
        z-index: 6;
    }

    .ace_marker-layer .ace_active-line {
        position: absolute;
        z-index: 2;
    }

    .ace_marker-layer .ace_selected-word {
        position: absolute;
        z-index: 4;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    .ace_line .ace_fold {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        display: inline-block;
        height: 11px;
        margin-top: -2px;
        vertical-align: middle;
        background-image: url(""), url("");
        background-repeat: no-repeat, repeat-x;
        background-position: center center, top left;
        color: transparent;
        border: 1px solid black;
        border-radius: 2px;
        cursor: pointer;
        pointer-events: auto;
    }

    .ace_dark .ace_fold {
    }

    .ace_fold:hover {
        background-image: url(""), url("");
    }

    .ace_tooltip {
        background-color: #FFF;
        background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));
        background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
        border: 1px solid gray;
        border-radius: 1px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        color: black;
        max-width: 100%;
        padding: 3px 4px;
        position: fixed;
        z-index: 999999;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        cursor: default;
        white-space: pre;
        word-wrap: break-word;
        line-height: normal;
        font-style: normal;
        font-weight: normal;
        letter-spacing: normal;
        pointer-events: none;
    }

    .ace_folding-enabled > .ace_gutter-cell {
        padding-right: 13px;
    }

    .ace_fold-widget {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        margin: 0 -12px 0 1px;
        display: none;
        width: 11px;
        vertical-align: top;
        background-image: url("");
        background-repeat: no-repeat;
        background-position: center;
        border-radius: 3px;
        border: 1px solid transparent;
        cursor: pointer;
    }

    .ace_folding-enabled .ace_fold-widget {
        display: inline-block;
    }

    .ace_fold-widget.ace_end {
        background-image: url("");
    }

    .ace_fold-widget.ace_closed {
        background-image: url("");
    }

    .ace_fold-widget:hover {
        border: 1px solid rgba(0, 0, 0, 0.3);
        background-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
    }

    .ace_fold-widget:active {
        border: 1px solid rgba(0, 0, 0, 0.4);
        background-color: rgba(0, 0, 0, 0.05);
        box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
    }

    .ace_dark .ace_fold-widget {
        background-image: url("");
    }

    .ace_dark .ace_fold-widget.ace_end {
        background-image: url("");
    }

    .ace_dark .ace_fold-widget.ace_closed {
        background-image: url("");
    }

    .ace_dark .ace_fold-widget:hover {
        box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
        background-color: rgba(255, 255, 255, 0.1);
    }

    .ace_dark .ace_fold-widget:active {
        box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
    }

    .ace_fold-widget.ace_invalid {
        background-color: #FFB4B4;
        border-color: #DE5555;
    }

    .ace_fade-fold-widgets .ace_fold-widget {
        -webkit-transition: opacity 0.4s ease 0.05s;
        transition: opacity 0.4s ease 0.05s;
        opacity: 0;
    }

    .ace_fade-fold-widgets:hover .ace_fold-widget {
        -webkit-transition: opacity 0.05s ease 0.05s;
        transition: opacity 0.05s ease 0.05s;
        opacity: 1;
    }

    .ace_underline {
        text-decoration: underline;
    }

    .ace_bold {
        font-weight: bold;
    }

    .ace_nobold .ace_bold {
        font-weight: normal;
    }

    .ace_italic {
        font-style: italic;
    }

    .ace_error-marker {
        background-color: rgba(255, 0, 0, 0.2);
        position: absolute;
        z-index: 9;
    }

    .ace_highlight-marker {
        background-color: rgba(255, 255, 0, 0.2);
        position: absolute;
        z-index: 8;
    }

    .ace_br1 {
        border-top-left-radius: 3px;
    }

    .ace_br2 {
        border-top-right-radius: 3px;
    }

    .ace_br3 {
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
    }

    .ace_br4 {
        border-bottom-right-radius: 3px;
    }

    .ace_br5 {
        border-top-left-radius: 3px;
        border-bottom-right-radius: 3px;
    }

    .ace_br6 {
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
    }

    .ace_br7 {
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
    }

    .ace_br8 {
        border-bottom-left-radius: 3px;
    }

    .ace_br9 {
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br10 {
        border-top-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br11 {
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br12 {
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br13 {
        border-top-left-radius: 3px;
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br14 {
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    .ace_br15 {
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }

    /*# sourceURL=ace/css/ace_editor.css */</style>
    <style id="ace-tm">.ace-tm .ace_gutter {
        background: #f0f0f0;
        color: #333;
    }

    .ace-tm .ace_print-margin {
        width: 1px;
        background: #e8e8e8;
    }

    .ace-tm .ace_fold {
        background-color: #6B72E6;
    }

    .ace-tm {
        background-color: #FFFFFF;
        color: black;
    }

    .ace-tm .ace_cursor {
        color: black;
    }

    .ace-tm .ace_invisible {
        color: rgb(191, 191, 191);
    }

    .ace-tm .ace_storage, .ace-tm .ace_keyword {
        color: blue;
    }

    .ace-tm .ace_constant {
        color: rgb(197, 6, 11);
    }

    .ace-tm .ace_constant.ace_buildin {
        color: rgb(88, 72, 246);
    }

    .ace-tm .ace_constant.ace_language {
        color: rgb(88, 92, 246);
    }

    .ace-tm .ace_constant.ace_library {
        color: rgb(6, 150, 14);
    }

    .ace-tm .ace_invalid {
        background-color: rgba(255, 0, 0, 0.1);
        color: red;
    }

    .ace-tm .ace_support.ace_function {
        color: rgb(60, 76, 114);
    }

    .ace-tm .ace_support.ace_constant {
        color: rgb(6, 150, 14);
    }

    .ace-tm .ace_support.ace_type, .ace-tm .ace_support.ace_class {
        color: rgb(109, 121, 222);
    }

    .ace-tm .ace_keyword.ace_operator {
        color: rgb(104, 118, 135);
    }

    .ace-tm .ace_string {
        color: rgb(3, 106, 7);
    }

    .ace-tm .ace_comment {
        color: rgb(76, 136, 107);
    }

    .ace-tm .ace_comment.ace_doc {
        color: rgb(0, 102, 255);
    }

    .ace-tm .ace_comment.ace_doc.ace_tag {
        color: rgb(128, 159, 191);
    }

    .ace-tm .ace_constant.ace_numeric {
        color: rgb(0, 0, 205);
    }

    .ace-tm .ace_variable {
        color: rgb(49, 132, 149);
    }

    .ace-tm .ace_xml-pe {
        color: rgb(104, 104, 91);
    }

    .ace-tm .ace_entity.ace_name.ace_function {
        color: #0000A2;
    }

    .ace-tm .ace_heading {
        color: rgb(12, 7, 255);
    }

    .ace-tm .ace_list {
        color: rgb(185, 6, 144);
    }

    .ace-tm .ace_meta.ace_tag {
        color: rgb(0, 22, 142);
    }

    .ace-tm .ace_string.ace_regex {
        color: rgb(255, 0, 0)
    }

    .ace-tm .ace_marker-layer .ace_selection {
        background: rgb(181, 213, 255);
    }

    .ace-tm.ace_multiselect .ace_selection.ace_start {
        box-shadow: 0 0 3px 0px white;
    }

    .ace-tm .ace_marker-layer .ace_step {
        background: rgb(252, 255, 0);
    }

    .ace-tm .ace_marker-layer .ace_stack {
        background: rgb(164, 229, 101);
    }

    .ace-tm .ace_marker-layer .ace_bracket {
        margin: -1px 0 0 -1px;
        border: 1px solid rgb(192, 192, 192);
    }

    .ace-tm .ace_marker-layer .ace_active-line {
        background: rgba(0, 0, 0, 0.07);
    }

    .ace-tm .ace_gutter-active-line {
        background-color: #dcdcdc;
    }

    .ace-tm .ace_marker-layer .ace_selected-word {
        background: rgb(250, 250, 255);
        border: 1px solid rgb(200, 200, 250);
    }

    .ace-tm .ace_indent-guide {
        background: url("") right repeat-y;
    }

    /*# sourceURL=ace/css/ace-tm */</style>
    <style>    .error_widget_wrapper {
        background: inherit;
        color: inherit;
        border: none
    }

    .error_widget {
        border-top: solid 2px;
        border-bottom: solid 2px;
        margin: 5px 0;
        padding: 10px 40px;
        white-space: pre-wrap;
    }

    .error_widget.ace_error, .error_widget_arrow.ace_error {
        border-color: #ff5a5a
    }

    .error_widget.ace_warning, .error_widget_arrow.ace_warning {
        border-color: #F1D817
    }

    .error_widget.ace_info, .error_widget_arrow.ace_info {
        border-color: #5a5a5a
    }

    .error_widget.ace_ok, .error_widget_arrow.ace_ok {
        border-color: #5aaa5a
    }

    .error_widget_arrow {
        position: absolute;
        border: solid 5px;
        border-top-color: transparent !important;
        border-right-color: transparent !important;
        border-left-color: transparent !important;
        top: -5px;
    }</style>
    <style>.ace_snippet-marker {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background: rgba(194, 193, 208, 0.09);
        border: 1px dotted rgba(211, 208, 235, 0.62);
        position: absolute;
    }</style>
    <style>.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
        background-color: #CAD6FA;
        z-index: 1;
    }

    .ace_editor.ace_autocomplete .ace_line-hover {
        border: 1px solid #abbffe;
        margin-top: -1px;
        background: rgba(233, 233, 253, 0.4);
    }

    .ace_editor.ace_autocomplete .ace_line-hover {
        position: absolute;
        z-index: 2;
    }

    .ace_editor.ace_autocomplete .ace_scroller {
        background: none;
        border: none;
        box-shadow: none;
    }

    .ace_rightAlignedText {
        color: gray;
        display: inline-block;
        position: absolute;
        right: 4px;
        text-align: right;
        z-index: -1;
    }

    .ace_editor.ace_autocomplete .ace_completion-highlight {
        color: #000;
        text-shadow: 0 0 0.01em;
    }

    .ace_editor.ace_autocomplete {
        width: 280px;
        z-index: 200000;
        background: #fbfbfb;
        color: #444;
        border: 1px lightgray solid;
        position: fixed;
        box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
        line-height: 1.4;
    }</style>
    <script src="/static/toget/text.js"></script>
    <script src="/static/toget/theme-monokai.js"></script>
    <script src="/static/toget/mode-c_cpp.js"></script>
    <style id="ace-monokai">.ace-monokai .ace_gutter {
        background: #2F3129;
        color: #8F908A
    }

    .ace-monokai .ace_print-margin {
        width: 1px;
        background: #555651
    }

    .ace-monokai {
        background-color: #272822;
        color: #F8F8F2
    }

    .ace-monokai .ace_cursor {
        color: #F8F8F0
    }

    .ace-monokai .ace_marker-layer .ace_selection {
        background: #49483E
    }

    .ace-monokai.ace_multiselect .ace_selection.ace_start {
        box-shadow: 0 0 3px 0px #272822;
    }

    .ace-monokai .ace_marker-layer .ace_step {
        background: rgb(102, 82, 0)
    }

    .ace-monokai .ace_marker-layer .ace_bracket {
        margin: -1px 0 0 -1px;
        border: 1px solid #49483E
    }

    .ace-monokai .ace_marker-layer .ace_active-line {
        background: #202020
    }

    .ace-monokai .ace_gutter-active-line {
        background-color: #272727
    }

    .ace-monokai .ace_marker-layer .ace_selected-word {
        border: 1px solid #49483E
    }

    .ace-monokai .ace_invisible {
        color: #52524d
    }

    .ace-monokai .ace_entity.ace_name.ace_tag, .ace-monokai .ace_keyword, .ace-monokai .ace_meta.ace_tag, .ace-monokai .ace_storage {
        color: #F92672
    }

    .ace-monokai .ace_punctuation, .ace-monokai .ace_punctuation.ace_tag {
        color: #fff
    }

    .ace-monokai .ace_constant.ace_character, .ace-monokai .ace_constant.ace_language, .ace-monokai .ace_constant.ace_numeric, .ace-monokai .ace_constant.ace_other {
        color: #AE81FF
    }

    .ace-monokai .ace_invalid {
        color: #F8F8F0;
        background-color: #F92672
    }

    .ace-monokai .ace_invalid.ace_deprecated {
        color: #F8F8F0;
        background-color: #AE81FF
    }

    .ace-monokai .ace_support.ace_constant, .ace-monokai .ace_support.ace_function {
        color: #66D9EF
    }

    .ace-monokai .ace_fold {
        background-color: #A6E22E;
        border-color: #F8F8F2
    }

    .ace-monokai .ace_storage.ace_type, .ace-monokai .ace_support.ace_class, .ace-monokai .ace_support.ace_type {
        font-style: italic;
        color: #66D9EF
    }

    .ace-monokai .ace_entity.ace_name.ace_function, .ace-monokai .ace_entity.ace_other, .ace-monokai .ace_entity.ace_other.ace_attribute-name, .ace-monokai .ace_variable {
        color: #A6E22E
    }

    .ace-monokai .ace_variable.ace_parameter {
        font-style: italic;
        color: #FD971F
    }

    .ace-monokai .ace_string {
        color: #E6DB74
    }

    .ace-monokai .ace_comment {
        color: #75715E
    }

    .ace-monokai .ace_indent-guide {
        background: url() right repeat-y
    }

    /*# sourceURL=ace/css/ace-monokai */</style>
    <script src="/static/toget/c_cpp.js"></script>
</head>
<body>


<!--  <button class="btn btn-default" id="txt_d">还原到默认code</button>-->
<style type="text/css" media="screen">
    #editor {
    / / position: absolute;
        width: 100%;
        height: 400px;
        float: left;
        font-size: 14px;
    }
</style>
<div id="editor" class=" ace_editor ace-monokai ace_dark"><textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false"
style="opacity: 0; height: 17px; width: 0px; left: 0px; top: 0px;">#include &lt;stdio.h&gt;</textarea>
<textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; height: 17px; width: 0px; left: 0px; top: 0px;">int main(){</textarea>
    <textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; height: 17px; width: 0px; left: 0px; top: 0px;">printf("您好");</textarea>
    <textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; height: 17px; width: 0px; left: 0px; top: 0px;">return 0;</textarea>
<textarea class="ace_text-input" wrap="off" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; height: 17px; width: 0px; left: 0px; top: 0px;">}</textarea>
</div>
<textarea rows="20" cols="100" id="editorBox" style="width: 100%; display: none;">#include &lt;stdio.h&gt;</textarea>

<script src="/static/toget/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/toget/ext-language_tools.js"></script>
<script>

    if (ie_error()) {

        $('#editor').hide();
    } else {
        $('#editorBox').hide();
        ace.require("ace/ext/language_tools");
        var editor = ace.edit("editor");
        editor.setOptions({
            enableBasicAutocompletion: true,
            enableSnippets: true,
            enableLiveAutocompletion: true
        });
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/c_cpp");
    }

</script>
<div style="float:left;width: 100%; margin-top: 20px;">


    <button type="submit" class="btn btn-default" id="btn">运行</button>
    <button class="btn btn-default" id="btninput">输入</button>
    <button class="btn btn-default" id="download">下载</button>
    <button class="btn btn-default" id="setcode">范例代码</button>
</div>
<div id="stdindiv" style="float: left; width: 100%; margin-top: 3px; display: none;">
    <div>输入：</div>
    <textarea rows="3" cols="100" id="stdin" style="width: 100%;">
</textarea>
</div>
<div style="float:left;width: 100%; margin: 10px 10px 10px 10px">
    <div class="radio-inline" style="display: none">
        <label>
            <input type="radio" name="optionsRadios" id="Radiostxt" value="txt" checked="checked">
            文本方式显示
        </label>
    </div>
</div>
<script type="text/javascript" src="/static/toget/jquery.zclip.js"></script>
<script type="text/javascript">


    $(function () {
        $('#btncp').zclip({
            path: '../bower/jquery-zclip/ZeroClipboard.swf',
            copy: function () {
                return getCodeTxt();
            },
            afterCopy: function () {
                $("<span id='msg'/>").insertAfter($('#btncp')).text('复制成功').fadeOut(2000);
            }
        });
        $('#copys').zclip({
            path: '../bower/jquery-zclip/ZeroClipboard.swf',
            copy: function () {
                return $('#shareUrl').val();
            },
            afterCopy: function () {
                $("<span id='msgs'/>").insertAfter($('#copys')).text('复制成功').fadeOut(2000);
            }
        });
    });

    function getCodeTxt() {
        if (typeof(editor) == "undefined") {
            return $('#editorBox').text();
        } else {
            return editor.getValue();
        }
    }

    function setCodeTxt(value) {
        if (typeof(editor) == "undefined") {
            $('#editorBox').val(value);
        } else {
            editor.setValue(value, -1);
        }

    }

    var code_default = getCodeTxt();
    var storage = $.jStorage.get(codetype, null)
    if (storage) {
        setCodeTxt(storage);
    }

    function textareachange() {
        var code = getCodeTxt();
        var storage = $.jStorage.get(codetype, null)
        if (storage != code) {
            $.jStorage.set(codetype, code);
        }
    }

    $('#setcode').click(function () {
        setCodeTxt(code_default);
        //$('#txt').val(code_default);
    })
    $('#stdindiv').hide();
    $('#btninput').click(function () {
        $('#stdindiv').toggle();
    });

    //alert(window.location.hash)
    pp = window.location.hash.split('#id/');
    if (pp.length == 2) {
        codeid = pp[1];
        $.ajax({
            type: "GET",
            url: "../shareCode.php?id=" + codeid,
            data: {},
            success: function (msg) {
                setCodeTxt(msg);
            },
            error: function () {

            }
        });
    }
</script>
<div style="float:left;width: 100%; margin-bottom: 100px">
    <div style="float: left; width: 100%; display: none;" id="cc"></div>
    <textarea rows="20" cols="100" id="kk" style="width: 100%; display: inline-block;"></textarea>
</div>
<div style="float:left;width: 100%;">
    <script>
        var apiurl = '';
        //var apiurl='http://127.0.0.1:3900';
        jQuery.support.cors = true;

        function runcodenew(value) {
            if (isrun) return;
            isrun = true;
            ttt = setTimeout(setRun, 20000);

            setHtml("祈祷中......");
            setTextarea("祈祷中......");
            var html = getCodeTxt();
            html = Base64.encode(html);
           // setHtml(html);
           // setTextarea(html);
            var stdin = $('#stdin').val();

            var langid = 7;
            // var codeF = $('#code').val();
            //var stdin = $('#stdin').val();
// passing the json file to the page 
            var message = {
                "option": value,
                "code": html,
                "stdin": stdin
            };
            //console.log(json);
            message = JSON.stringify(message);
            $.post(apiurl + "/compile",message, function (data) {
                if (data.length > 0) {
                    isrun = false;
                    //  setHtml();
                    //  setTextarea(html);

                } else {
                    isrun = false;
                  //  setHtml();
                  //  setTextarea(html);

                }
                if(value==1){
                setHtml(data);
                setTextarea(data);
                }else{
                    window.location.href='/index/index/download';
                    setHtml("文件已传输");
                    setTextarea("文件已传输");
                }
            });

        }


        var isrun = false;
        var htmlshow = true;
        var txtshow = true;

        function setHtml(html) {
            if (htmlshow == false) return;
            $('#cc').html(html);
        }

        function setTextarea(value) {
            if (txtshow == false) return;
            $('#kk').val(value);
        }

        var ttt;

        function setRun() {
            isrun = false;
        }

        $('#btn').click(function (){
            runcodenew(1)}
        );
        $('#download').click(function (){runcodenew(2)});
        var showtype = $.jStorage.get('showtype-' + codetype, 'txt');
        $('#Radios' + showtype).attr('checked', true);
        var showselect = function () {
            var selectedvalue = $("input:radio[name=optionsRadios]:checked").val();
            //alert($selectedvalue);
            $.jStorage.set('showtype-' + codetype, selectedvalue);
            if (selectedvalue == 'html') {
                htmlshow = true;
                txtshow = false;
                $('#cc').show();
                $('#kk').hide();

            } else if (selectedvalue == 'txt') {
                htmlshow = false;
                txtshow = true;
                $('#cc').hide();
                $('#kk').show();

            }
        }
        $("input[name=optionsRadios]:radio").change(showselect);
        showselect();
    </script>
</div>
</div>

</div>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="/static/toget/bootstrap.min.js"></script>
<script type="text/javascript">
    setInterval('textareachange()', 1000);

    function hotkey() {
        var a = window.event.keyCode;
        //alert(a);
        if ((a == 88) && (event.ctrlKey)) {
            $('#btn').click();
        }
    }// end hotkey
    document.onkeydown = hotkey;
</script>


<div class="container">
    <div class="footer">
        <p><a id="contact"></a></p>
        <!--兼容版，可保证页面完全兼容-->
        <div id="SOHUCS" sid="runcodec语言"></div>

    </div>

</div>

<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?22591d167334c709db7c8062a668bd46";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>


</body>
</html>